import React from 'react';
import { Spinner } from 'react-bootstrap';

const ZSpinner = ({ loading, children }) => {
  return (
    <>
      {loading && (
        <Spinner
          animation="border"
          role="status"
          style={{ margin: '1rem', position: 'absolute' }}
        >
          <span className="sr-only">加载中...</span>
        </Spinner>
      )}
      {children}
    </>
  );
};

export default ZSpinner;
